<include file="public@header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('user/campus')}">机构列表</a></li>
        <li class="active"><a href="{:url('user/addCampus')}">添加机构</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('user/addCampus')}">
        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('USERNAME')}</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-user_login" name="user_login">
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('PASSWORD')}</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-user_pass" name="user_pass" placeholder="******">
            </div>
        </div>
        <input type="hidden" name="user_type" value="2">
        <div class="form-group">
            <label for="input-user_nickname" class="col-sm-2 control-label"><span class="form-required">*</span>机构名称</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-user_nickname" name="user_nickname">
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>校区</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" style="width: 90%;" id="input-campus" name="campusList[]" required>
                <a href="javascript:" class="btn btn-primary js-ajax-submit" id="addInput">添加一行</a>
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_nickname" class="col-sm-2 control-label">logo</label>
            <div class="col-md-6 col-sm-10">
                <input type="hidden" name="avatar" id="thumb" value="">
                <a href="javascript:uploadOneImage('图片上传','#thumb');">
                    <img src="__TMPL__/public/assets/images/default-thumbnail.png" id="thumb-preview"
                         width="135" style="cursor: hand"/>
                </a>
                <input type="button" class="btn btn-sm"
                       onclick="$('#thumb-preview').attr('src','__TMPL__/public/assets/images/default-thumbnail.png');$('#thumb').val('');return false;"
                       value="取消图片">
            </div>
        </div>

        <div class="form-group">
            <label for="input-user_nickname" class="col-sm-2 control-label">机构介绍</label>
            <div class="col-md-6 col-sm-10">
                <script type="text/plain" id="content" name="more"></script>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="/static/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/static/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $("#addInput").click(function(){
            $("#addInput").before(
                '<div><input  type="text" class="form-control" required style="width:90%;display:inline;" name="campusList[]">' +
                '<img style="display:inline;" src="/static/images/delete.gif" onclick="dropGoods(this)" /></div>'
            );
        })
    })
    function dropGoods(obj) {
        $(obj).parent().remove();
        $(obj).remove()
    }
</script>
</body>
</html>